-module(fileretrieve).
-export([start/3]).
-import(erlang, [display/1]).

start(Neighbors, Tag, Proc) ->
	random:seed(now()),
	io:format("Starting gossip loop for retrieving fragment ~p~n", [Tag]),
	
	case gossipprob:getGossipNode(Neighbors) of
	  {ok, Node} ->
			io:format("Talking to node ~p~n", [Node]),
			Node ! {retrieve, Tag, Proc};
		{error, _Msg} ->
			io:format("Talking to myself~n")
	end,
	ok.